<%@ page language="java" contentType="text/html; charset=utf-8" import="com.bjsxt.shopping.user.*"
    pageEncoding="utf-8"%>
    
 <%
String path = request.getContextPath();
String basePath = request.getScheme() + "://"
+ request.getServerName() + ":" + request.getServerPort()
+ path + "/"; 
%>

<%
String action = request.getParameter("action");
if(action != null && action.equals("login")) {
	String username = request.getParameter("username");
	String password = request.getParameter("password");
	User u = null;
	try {
		u = User.check(username, password);
	} catch (UserNotFoundException e) {
		out.println(e.getMessage());
		return;
	} catch (PasswordNotCorrectException e) {
		out.println(e.getMessage());
		return;
	}

	session.setAttribute("user", u);
	session.setAttribute("loginname", u.getLoginname());
	
	String userType = u.getAcctype();
	String userStatus = u.getStatus();
	
	//管理员
	if(userType.equals("0")){
		response.sendRedirect("MobileArticleState.jsp");
	}else if(userType.equals("2")){
		//译者
	   if(userStatus.equals("1")){
	   //审核已通过
			response.sendRedirect("mobileQiangDan.jsp");
		}else if(userStatus.equals("0")){
			out.println("您的注册资料还未通过管理员审核,请耐心等待。");
			return;
		}else if(userStatus.equals("2")){
			out.println("您的注册试题未通过管理员审核,请重新翻译试题并提交注册！");
			return;
		}

	}else{
			out.println("您没有权限登录此平台！");
			return;
	}
}
%>

 <!DOCTYPE html>
<html>
<head>
       <meta name="viewport" content="width=device-width, initial-scale=1">
		<title>欢迎来到众译快翻移动端平台！</title>

        <link rel="stylesheet" href="<%=basePath%>Plug/jquery.mobile-1.2.0/jquery.mobile-1.2.0.min.css" />
        <link rel="stylesheet" href="<%=basePath%>Plug/jquery.mobile-1.2.0/demos/docs/_assets/css/jqm-docs.css" />
</head>
<body>
	<div data-role="page" class="type-interior" id="januarySales">
	<div  style="background:#ccff99; color:#000; height:80px; text-align:center; line-height:80px;   ">
	<font size="8" style="font-weight:bold;color:black;font-style:italic;  ">众译快翻</font>
	</div>	
	
	<div  style="background:#ffffff; color:#000; height:20px;  ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;欢迎来到众译快翻移动端平台！</div>	
	<table border="0" align="center">
		<tr>
				<td align="center"><img src="images/wzfy1.png" height="100" width="140">
				<br><br>
				</td>
				
		</tr>
		<tr>
			<td>
			  <div>
				<form  method="post" action="" onSubmit="this.regsubmit.disabled=true;">
					<input type="hidden" name="action" value="login"/>
					<table border="1" align="center">
						<tr>
						
						</tr>
						<tr>
							<td>用户名:</td>
							<td><input type="text" size="20" name="username"/></td>
						</tr>
						<tr>
							<td>密码:</td>
							<td><input type="password" size="20" name="password"/></td>
						</tr>
						<tr>
							<td></td>
							<td><input type="submit" value="登录"/></td>
						</tr>
					</table>
				
				</form>
				
			  </div>	
			</td>
	</tr>

		</table>
</div>	
</body>
</html>